'''
pyQuery 

Test case for attributes statement q.<..>

@author: Yauhen Yakimovich
'''
import unittest
from pyQuery import q

class Test(unittest.TestCase):


    def testLocalFunctions(self):
        from string import replace
        concat = lambda s, v: s + v
        r = q('foo').f_replace('f', 'b').f_replace('o', 'a').r
        self.assertEquals(r, 'baa')
        r = q(r).f_replace('aa', '').f_concat('ar').r
        self.assertEquals(r, 'bar')


if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testName']
    unittest.main()
